const forbiddenProtocols = [
  'chrome-extension://',
  'chrome-search://',
  'chrome://',
  'devtools://',
  'edge://',
  'https://chrome.google.com/webstore',
]

export function isForbiddenUrl(url: string): boolean {
  return forbiddenProtocols.some(protocol => url.startsWith(protocol))
}

export const isFirefox = navigator.userAgent.includes('Firefox')

// 环境变量配置
export const ENV = {
  API_BASE_URL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000/api',
  THIRD_PARTY_API: import.meta.env.VITE_THIRD_PARTY_API || 'https://api.example.com',
  LOGIN_DOMAIN: import.meta.env.VITE_LOGIN_DOMAIN || 'https://your-auth-domain.com',
  APP_NAME: import.meta.env.VITE_APP_NAME || 'influencer-shield',
  DEBUG: import.meta.env.VITE_DEBUG === 'true',
  PORT: Number(import.meta.env.VITE_PORT) || 3303,
}

// API 配置
export const API_CONFIG = {
  BASE_URL: ENV.API_BASE_URL,
  THIRD_PARTY_API: ENV.THIRD_PARTY_API,
  TIMEOUT: 10000,
  RETRY_TIMES: 3,
}

// API 端点
export const API_ENDPOINTS = {
  GET_INFLUENCER: (id: string) => `${API_CONFIG.BASE_URL}/influencers/${id}`,
  GET_REPORTS: (id: string) => `${API_CONFIG.BASE_URL}/reports/${id}`,
  GET_REPORT_COUNT: (platformUserId: string) => `${API_CONFIG.BASE_URL}/reports/count?platform_user_id=${encodeURIComponent(platformUserId)}`,
  CREATE_REPORT: () => `${API_CONFIG.BASE_URL}/reports`,
  AUTH_LOGIN: () => `${ENV.LOGIN_DOMAIN}/login`,
  AUTH_CALLBACK: () => `${ENV.LOGIN_DOMAIN}/callback`,
}
